package cn.edu.zafu.bigdata.zqt.cube;

public class Cube {
    double length;
    double width;
    double height;

    public Cube(double length, double width, double height) {
        this.length = length;
        this.width = width;
        this.height = height;
    }
    public  double getLength() {
        return length;
    }
    public  double getWidth() {
        return width;
    }
    public  double getHeight() {
        return height;
    }
    @Override
    public boolean equals(Object obj) {
        if(this==obj){
            return true;
        }
        if (obj == null||getClass() != obj.getClass()) {
            return false;
        }
        Cube cube = (Cube) obj;
        return Double.compare(cube.length, length) == 0 &&
                Double.compare(cube.width, width) == 0 &&
                Double.compare(cube.height, height) == 0;
    }

    public static void main(String[] args) {
        Cube cube = new Cube(10, 10, 10);
        Cube cube2 = new Cube(10, 10, 9);
        Cube cube3 = new Cube(10, 10, 10);
        System.out.println(cube.equals(cube2));
        System.out.println(cube.equals(cube3));
    }
}
